package com.ruoyi.service.tourism.impl;

import com.ruoyi.mapper.tourism.HeadquartersMapper;
import com.ruoyi.service.tourism.HeadquartersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.UUID;

/**
 * @author zeo
 * @explain 文旅总部模块
 * @date 2021/2/3 8:53
 */
@Service
public class HeadquartersServiceImpl implements HeadquartersService {

    @Autowired
    HeadquartersMapper headquartersMapper;

    @Override
    public List<Map<String, Object>> findHeadquartersMonthList(Map map) {
        return headquartersMapper.findHeadquartersMonthList(map);
    }

    @Override
    public List<Map<String, Object>> findHeadquartersDayList(Map map) {
        return headquartersMapper.findHeadquartersDayList(map);
    }

    @Override
    public int addHeadquarters(Map map) {
        String uuid = UUID.randomUUID().toString().trim().replaceAll("-", "");
        map.put("foreignId", uuid);
        headquartersMapper.addShare(map);
        return headquartersMapper.addHeadquarters(map);
    }

    @Override
    public Map findHeadquartersById(String id) {
        return headquartersMapper.findHeadquartersById(id);
    }

    @Override
    public int editHeadquarters(Map map) {
        return headquartersMapper.editHeadquarters(map) + headquartersMapper.editShare(map);
    }

    @Override
    public Map getLastDayData(Map map) {
        return headquartersMapper.getLastDayData(map);
    }
}
